﻿using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;

namespace JustMetClient.Models.StrategyModels
{
    /// <summary>
    /// 策略包模型
    /// </summary>
    public class StrategyBagModel
    {
        /// <summary>
        /// 版本号
        /// </summary>
        public string Version { get; set; }
        /// <summary>
        /// 策略列表
        /// </summary>
        public List<StrategyModel> StrategyList { get; set; }

        public int GetStrategyListCount()
        {
            if (StrategyList != null) return StrategyList.Count;
            return 0;
        }
        public int GetDisconnectStrategyListCount()
        {
            int count = 0;
            if (GetStrategyListCount() > 0)
            {
                foreach (var item in StrategyList)
                {
                    if (item != null && item.Event != null && item.Event.Dispose != null)
                    {
                        if (item.Event.Dispose.Any(x => x == "disconnect"))
                        {
                            count++;
                            //仅添加会导致断网的策略信息，进行合规性检查
                            //tasks.Add(item.ToStrategyTask());
                        }
                    }
                }
            }
            return count;
        }
    }
}
